﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ScoreController : MonoBehaviour,IComponentsgoalListener,IComponentsScoreListener
{
    private Text _text;
    void Start()
    {
        _text = GetComponent<Text>();
        var entity = Contexts.sharedInstance.game.CreateEntity();
        entity.AddComponentsgoalListener(this);
       
        
    }

    void Update()
    {
        _text.text = Contexts.sharedInstance.game.componentsScore.score.ToString();
    }

    public void OnComponentsScore(GameEntity entity, int score)
    {
        Debug.Log("modify Score");
        _text.text = score.ToString();
    }

    public void OnComponentsgoal(GameEntity entity, int goal)
    {
        Debug.Log("modify Score");
        _text.text = goal.ToString();
    }
}
